package com.example.demoserver.util;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Value("${inteUrl.dir}")
    private String inteUrl;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 将所有/files/** 的请求映射到文件系统的/path/to/your/files 目录下
        registry.addResourceHandler("/files/**")
                .addResourceLocations("file:"+inteUrl+"/");
    }
}
